#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
#依据不同相似度的计算结果，调整相似度阈值

输入：相似度两两计算结果-method.txt
输出：不同阈值的重复结果-compare.csv

'''

import csv
def cal_data(method,thre):
    input_path = './result/'+method+'.txt'
    out_path = './result/'+method+'-'+thre+'.csv'
    csv_writer = csv.writer(open(out_path,'w',encoding = 'utf-8',newline=''))
    with open(input_path,'r',encoding='utf-8')as f:
        for data in f.readlines():
            if float(data.split(',')[-1]) >= thre:
                csv_writer.writerow(data.split(','))


if __name__=='__main__':
    cal_data(method="jaccard",thre=0.3)